﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleActor
{
    /// <summary>
    /// Represents the asynchronous operation.
    /// </summary>
    /// <typeparam name="TServant">The type of actor servant.</typeparam>
    internal interface IAsyncMessage<TServant> where TServant : IActorServant
    {
        /// <summary>
        /// Gets the method name.
        /// </summary>
        string MethodName { get; }

        /// <summary>
        /// Invokes operation.
        /// </summary>
        /// <param name="servant">The actor servant.</param>
        void Invoke(TServant servant);

        /// <summary>
        /// Aborts operation.
        /// </summary>
        /// <param name="newException">The exception factory.</param>
        void Abort(Func<Exception> newException);
    }
}
